<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.xy.weixin.tuling.entity.*"%>

<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="description" content="">
  <meta name="keywords" content="">
  <meta name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <title>图灵测试</title>

  <!-- Set render engine for 360 browser -->
  <meta name="renderer" content="webkit">

  <!-- No Baidu Siteapp-->
  <meta http-equiv="Cache-Control" content="no-siteapp"/>

  <link rel="icon" type="image/png" href="<%=request.getContextPath()%>/wap/assets/i/favicon.png">

  <!-- Add to homescreen for Chrome on Android -->
  <meta name="mobile-web-app-capable" content="yes">
  <link rel="icon" sizes="192x192" href="<%=request.getContextPath()%>/wap/assets/i/app-icon72x72@2x.png">

  <!-- Add to homescreen for Safari on iOS -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
  <link rel="apple-touch-icon-precomposed" href="<%=request.getContextPath()%>/wap/assets/i/app-icon72x72@2x.png">

  <!-- Tile icon for Win8 (144x144 + tile color) -->
  <meta name="msapplication-TileImage" content="<%=request.getContextPath()%>/wap/assets/i/app-icon72x72@2x.png">
  <meta name="msapplication-TileColor" content="#0e90d2">

  <link rel="stylesheet" href="<%=request.getContextPath()%>/wap/assets/css/amazeui.min.css">
  <link rel="stylesheet" href="<%=request.getContextPath()%>/wap/assets/css/app.css">
</head>
<body>
<!--在这里编写你的代码-->

<header data-am-widget="header" class="am-header am-header-default">
  <div class="am-header-left am-header-nav">
    <a href="<%=request.getContextPath()%>/wap/index.jsp" class="">
      <i class="am-header-icon am-icon-home"></i>
    </a>
  </div>
  <h1 class="am-header-title">
    <a href="#title-link" class="">图灵机器人</a>
  </h1>
</header>

<div class="am-panel am-panel-default">
<%
		BaseEntity<?> baseEntity = (BaseEntity<?>) request
				.getAttribute("info");
		if (baseEntity != null) {
			switch (baseEntity.getCode()) {
			case 100000: //文本类数据
			%>
				<div class="am-panel-bd"><%=baseEntity.getText().trim() %></div>
				<%
				break;
			case 305000: //列车
				BaseEntity<TrainEntity> trainEntity = (BaseEntity<TrainEntity>) baseEntity;
				//out.println("Text:" + trainEntity.getCode());
				//detailurl:http://touch.qunar.com/h5/train/
				for (TrainEntity entity : trainEntity.getList()) {
					/*
					out.println("trainnum:" + entity.getTrainnum()
							+ " start:" + entity.getStart() + " terminal:"
							+ entity.getTerminal() + " starttime:"
							+ entity.getStarttime() + " endtime:"
							+ entity.getEndtime() + " detailurl:"
							+ entity.getDetailurl() + " icon:"
							+ entity.getIcon());*/
				} %>
				<div class="am-panel-bd">您可以通过网址查询具体信息，请点击<a href='http://touch.qunar.com/h5/train/'>打开网址</a></div>
				<%
				break;
			case 306000: //航班
				BaseEntity<FlightEntity> flightEntity = (BaseEntity<FlightEntity>) baseEntity;
				//out.println("Text:" + flightEntity.getCode());
				//detailurl:http://touch.qunar.com/h5/flight/
				/*
				for (FlightEntity entity : flightEntity.getList()) {
					out.println("flight:" + entity.getFlight() + " route:"
							+ entity.getRoute() + " starttime:"
							+ entity.getStarttime() + " endtime:"
							+ entity.getEndtime() + " state:"
							+ entity.getState() + " detailurl:"
							+ entity.getDetailurl() + " icon:"
							+ entity.getIcon());
				}
				*/
				%>
				<div class="am-panel-bd"><br/>您可以通过网址查询具体信息，请点击<a href='http://touch.qunar.com/h5/flight/'>打开网址</a></div>
				<%
				break;
			case 200000: //网址类数据
				//请点击 <a href="+baseEntity.getUrl()+">打开页面</a>
				/*
				out.println("Text:" + baseEntity.getText());
				out.println("Url:" + baseEntity.getUrl());
				*/
				%>
				<div class="am-panel-bd"><a href='<%=baseEntity.getUrl() %>'><%=baseEntity.getText() %></a></div>
				<%
				break;
			case 302000: //新闻
				BaseEntity<NewsEntity> newsEntity = (BaseEntity<NewsEntity>) baseEntity;
				//out.println("Text:" + newsEntity.getCode());
				for (NewsEntity entity : newsEntity.getList()) {
					/*
					out.println("article:" + entity.getArticle()
							+ " source:" + entity.getSource()
							+ " detailurl:" + entity.getDetailurl()
							+ " icon:" + entity.getIcon());
					*/
					%>
					<div class="am-panel-bd"><a href='<%=entity.getDetailurl() %>'><%= entity.getArticle() %></a></div>
					<%
				}
				break;
			case 308000: //菜谱、视频、小说
				BaseEntity<InfoEntity> infoEntity = (BaseEntity<InfoEntity>) baseEntity;
				//out.println("Text:" + infoEntity.getCode());
				for (InfoEntity entity : infoEntity.getList()) {
					/*
					out.println("name:" + entity.getName() + " info:"
							+ entity.getInfo() + " detailurl:"
							+ entity.getDetailurl() + " icon:"
							+ entity.getIcon());
					*/
					%>
					<div class="am-panel-bd"><a href='<%=entity.getDetailurl() %>'><%= entity.getName() %></a></div>
					<%
				}
				break;
			default: //其他
				break;
			}
		} else {
			 %>
			 <div class="am-panel-bd">你说的太高深了哦！o(╯□╰)o</div>
			<%
		}
	%>
</div>


<!--[if (gte IE 9)|!(IE)]><!-->
<script src="assets/js/jquery.min.js"></script>
<!--<![endif]-->
<!--[if lte IE 8 ]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<![endif]-->
</body>
</html>
